﻿FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Client/Client.BlazorWasmApp/Client.BlazorWasmApp.csproj", "Client/Client.BlazorWasmApp/"]
COPY ["Swimj/Swimj.Core/Swimj.Core.csproj", "Swimj/Swimj.Core/"]
COPY ["Swimj/Swimj.CommonLib/Swimj.CommonLib.csproj", "Swimj/Swimj.CommonLib/"]
COPY ["Swimj/Swimj.RazorLib/Swimj.RazorLib.csproj", "Swimj/Swimj.RazorLib/"]
COPY ["Admin/Admin.RazorLib/Admin.RazorLib.csproj", "Admin/Admin.RazorLib/"]
COPY ["Admin/Admin.CommonLib/Admin.CommonLib.csproj", "Admin/Admin.CommonLib/"]
COPY ["BaseData/BaseData.RazorLib/BaseData.RazorLib.csproj", "BaseData/BaseData.RazorLib/"]
COPY ["BaseData/BaseData.CommonLib/BaseData.CommonLib.csproj", "BaseData/BaseData.CommonLib/"]
COPY ["Production/Production.RazorLib/Production.RazorLib.csproj", "Production/Production.RazorLib/"]
COPY ["Production/Production.CommonLib/Production.CommonLib.csproj", "Production/Production.CommonLib/"]
RUN dotnet restore "Client/Client.BlazorWasmApp/Client.BlazorWasmApp.csproj"
COPY . .
WORKDIR "/src/Client/Client.BlazorWasmApp"
RUN dotnet build "Client.BlazorWasmApp.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Client.BlazorWasmApp.csproj" -c Release -o /app/publish

FROM nginx:alpine AS final
EXPOSE 80
WORKDIR /usr/share/nginx/html
COPY --from=publish /app/publish/wwwroot .
COPY Client/Client.BlazorWasmApp/nginx.conf /etc/nginx/nginx.conf
